package com.kaiwukj.android.ufamily.utils;

import android.content.Context;
import android.media.MediaPlayer;

import com.kaiwukj.android.ufamily.R;


/**
 * Created by wk on 2017/12/22.
 */

public class CallHintUtil {

    private static MediaPlayer mRingerPlayer;

    public static void callInComing(Context context) {

        long[] pattern = {500, 500, 500};
        if (mRingerPlayer == null || !mRingerPlayer.isPlaying()) {
            mRingerPlayer = MediaPlayer.create(context, R.raw.bg_music1);
//        mMediaPlayer.prepare();
            mRingerPlayer.setLooping(true);
            mRingerPlayer.start();
            VibratorUtil.vibrate(context.getApplicationContext(), pattern, 1);
        }
    }

    public static void stopInComingHint(Context context) {

        VibratorUtil.virateCancle(context.getApplicationContext());
        if (mRingerPlayer != null) {
            mRingerPlayer.stop();
            mRingerPlayer.release();
            mRingerPlayer = null;
        }
    }


}
